package Service.Admin.Imp;

import Dao.Admin.AdminCountDao;
import Dao.DaoFactory;
import Service.Admin.AdminCountService;
import Util.DBUtil;

import java.sql.Connection;

public class AdminCountServiceImp implements AdminCountService {
    private AdminCountDao adminCountDao;
    private Connection conn;

    public AdminCountServiceImp(){
        conn= DBUtil.getConnByDruid();
        adminCountDao = DaoFactory.getInstance("adminCountDao");
    }

    /**查询学生总数已选题学生数*/
    public String adminStuCount(){
        Integer res1 = adminCountDao.adminStuCount(conn);
        Integer res2 = adminCountDao.adminStuTitleCount(conn);
        String res = res1 + "," + res2;
        DBUtil.closeConn(conn);
        return res;
    }

    /**任务书学生数*/
    public String assignCount(){
        Integer res1 = adminCountDao.assignCount(conn);
        Integer res2 = adminCountDao.assignPassCount(conn);
        String res = res1 + "," + res2;
        DBUtil.closeConn(conn);
        return res;
    }


    /**开题报告学生数*/
    public String reportCount(){
        Integer res1 = adminCountDao.reportCount(conn);
        Integer res2 = adminCountDao.reportPassCount(conn);
        String res = res1 + "," + res2;
        DBUtil.closeConn(conn);
        return res;
    }


    /**中期检查学生数*/
    public String mediumCount(){
        Integer res1 = adminCountDao.mediumCount(conn);
        Integer res2 = adminCountDao.mediumPassCount(conn);
        String res = res1 + "," + res2;
        DBUtil.closeConn(conn);
        return res;
    }


    /**论文初稿学生数*/
    public String firstCount(){
        Integer res1 = adminCountDao.firstCount(conn);
        Integer res2 = adminCountDao.firstPassCount(conn);
        String res = res1 + "," + res2;
        DBUtil.closeConn(conn);
        return res;
    }


    /**定稿学生数*/
    public String finalizeCount(){
        Integer res1 = adminCountDao.finalizeCount(conn);
        Integer res2 = adminCountDao.finalizePassCount(conn);
        String res = res1 + "," + res2;
        DBUtil.closeConn(conn);
        return res;
    }


    /**终稿学生数*/
    public String finalCount(){
        Integer res1 = adminCountDao.finalCount(conn);
        Integer res2 = adminCountDao.finalPassCount(conn);
        String res = res1 + "," + res2;
        DBUtil.closeConn(conn);
        return res;
    }
}
